package com.leader.life.base

import android.os.Bundle
import android.support.annotation.LayoutRes
import android.support.v7.app.AppCompatActivity
import android.util.Log
import android.widget.Toast

abstract class BaseActivity : AppCompatActivity() {
    private val TAG: String = this.javaClass.name

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(layoutId())
        initUI()
    }

    abstract fun initUI()

    @LayoutRes
    abstract fun layoutId(): Int

    fun toast(toast: String) {
        Toast.makeText(this, toast, Toast.LENGTH_SHORT).show()
    }

    fun log(log: String, tag: String = TAG) {
        Log.e(tag, log)
    }
}